package com.bawei.system.remote.api;



import com.bawei.common.core.constant.ServiceNameConstants;
import com.bawei.common.core.domain.R;
import com.bawei.system.domain.vo.EsDocInsertVo;
import com.bawei.system.domain.vo.EsDocQueryVo;
import com.bawei.system.remote.factory.RemoteEsDocFallbackFactory;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

/**
 * 全文检索服务
 *
 * @author bawei
 */
@FeignClient(contextId = "remoteEsDocService", value = ServiceNameConstants.ES_SERVICE, fallbackFactory = RemoteEsDocFallbackFactory.class)
public interface RemoteEsDocService {

    @PostMapping("/esDoc/batchInsertDocs")
    public R<Boolean> batchInsertDocs(@RequestBody List<EsDocInsertVo> esDocInsertVo);

    @PostMapping("/esDoc/batchDeleteDocs")
    public R batchDeleteDocs(@RequestBody ArrayList<String> list,@RequestParam("indexName") String indexName);

    @PostMapping("/esDoc/queryDocs")
    public R queryDocs(@RequestBody EsDocQueryVo esDocInsertVo);

    @GetMapping("/esDoc/querySuggestions/{indexName}/{keyWord}/{suggestFiled}")
    @ApiOperation(value = "自动补全联想搜索")
    public R  querySuggestions(@PathVariable("indexName") String indexName,@PathVariable("keyWord") String keyWord,@PathVariable("suggestFiled") String suggestFiled);

}
